home *** CD-ROM | disk | FTP | other *** search
/ Champak 33 / Volume 33 - JOGO DISK .iso / Games / pin_ball_deluxe.swf / scripts / DefineSprite_426 / frame_1 / DoAction_2.as next >
Text File  |  2007-01-15  |  9KB  |  262 lines

  1. function findPossibleSegmentTarget()
  2. {
  3.    antSeg = segmentT;
  4.    _root.ball2rightBumper = false;
  5.    _root.ball2leftBumper = false;
  6.    _root.ball2rightTargetBlock = false;
  7.    _root.ball2leftTargetBlock = false;
  8.    _root.ball2rightFlipper = false;
  9.    _root.ball2leftFlipper = false;
  10.    _root.ball2rightRamp2 = false;
  11.    _root.ball2leftRamp2 = false;
  12.    _root.ball2rightRamp1 = false;
  13.    _root.ball2leftRamp1 = false;
  14.    tempSegments = new Array();
  15.    if(_root.ball2rightBumper != true && _root.ball2leftBumper != true && _root.ball2rightTargetBlock != true && _root.ball2leftTargetBlock != true && _root.ball2rightFlipper != true && _root.ball2leftFlipper != true && _root.ball2rightRamp2 != true && _root.ball2leftRamp2 != true && _root.ball2rightRamp1 != true && _root.ball2leftRamp1 != true)
  16.    {
  17.       for(var _loc5_ in _root.ball2splitSegment1)
  18.       {
  19.          if(_root.ball2splitSegment1[_loc5_].isPossibleTarget(this))
  20.          {
  21.             tempSegments[tempSegments.length] = _root.ball2splitSegment1[_loc5_];
  22.          }
  23.       }
  24.    }
  25.    if(this._x > _root.tbRLine._x)
  26.    {
  27.       for(_loc5_ in _root.splitSegment6)
  28.       {
  29.          if(_root.splitSegment6[_loc5_].isPossibleTarget(this))
  30.          {
  31.             tempSegments[tempSegments.length] = _root.splitSegment6[_loc5_];
  32.          }
  33.       }
  34.    }
  35.    if(this._y < _root.topBLine._y)
  36.    {
  37.       for(_loc5_ in _root.splitSegment4)
  38.       {
  39.          if(_root.splitSegment4[_loc5_].isPossibleTarget(this))
  40.          {
  41.             tempSegments[tempSegments.length] = _root.splitSegment4[_loc5_];
  42.          }
  43.       }
  44.       for(_loc5_ in _root.splitSegment5)
  45.       {
  46.          if(_root.splitSegment5[_loc5_].isPossibleTarget(this))
  47.          {
  48.             tempSegments[tempSegments.length] = _root.splitSegment5[_loc5_];
  49.          }
  50.       }
  51.    }
  52.    if(this._y > _root.ramp2T._y)
  53.    {
  54.       if(this._y < _root.ramp2B._y)
  55.       {
  56.          if(this._x > _root.ramp2L1._x)
  57.          {
  58.             if(this._x < _root.ramp2L2._x)
  59.             {
  60.                _root.ball2leftRamp2 = true;
  61.                for(_loc5_ in _root.splitSegment7)
  62.                {
  63.                   if(_root.splitSegment7[_loc5_].isPossibleTarget(this))
  64.                   {
  65.                      tempSegments[tempSegments.length] = _root.splitSegment7[_loc5_];
  66.                   }
  67.                }
  68.                for(_loc5_ in _root.ball2splitSegment11)
  69.                {
  70.                   if(_root.ball2splitSegment11[_loc5_].isPossibleTarget(this))
  71.                   {
  72.                      tempSegments[tempSegments.length] = _root.ball2splitSegment11[_loc5_];
  73.                   }
  74.                }
  75.                for(_loc5_ in _root.splitSegment17)
  76.                {
  77.                   if(_root.splitSegment17[_loc5_].isPossibleTarget(this))
  78.                   {
  79.                      tempSegments[tempSegments.length] = _root.splitSegment17[_loc5_];
  80.                   }
  81.                }
  82.             }
  83.          }
  84.          if(this._x > _root.ramp2R2._x)
  85.          {
  86.             if(this._x < _root.ramp2R1._x)
  87.             {
  88.                _root.ball2rightRamp2 = true;
  89.                for(_loc5_ in _root.splitSegment9)
  90.                {
  91.                   if(_root.splitSegment9[_loc5_].isPossibleTarget(this))
  92.                   {
  93.                      tempSegments[tempSegments.length] = _root.splitSegment9[_loc5_];
  94.                   }
  95.                }
  96.                for(_loc5_ in _root.ball2splitSegment12)
  97.                {
  98.                   if(_root.ball2splitSegment12[_loc5_].isPossibleTarget(this))
  99.                   {
  100.                      tempSegments[tempSegments.length] = _root.ball2splitSegment12[_loc5_];
  101.                   }
  102.                }
  103.             }
  104.          }
  105.       }
  106.    }
  107.    if(this._y > _root.ramp1T._y)
  108.    {
  109.       if(this._y < _root.ramp1B._y)
  110.       {
  111.          if(this._x > _root.ramp1L1._x)
  112.          {
  113.             if(this._x < _root.ramp1L2._x)
  114.             {
  115.                _root.ball2leftRamp1 = true;
  116.                for(_loc5_ in _root.splitSegment8)
  117.                {
  118.                   if(_root.splitSegment8[_loc5_].isPossibleTarget(this))
  119.                   {
  120.                      tempSegments[tempSegments.length] = _root.splitSegment8[_loc5_];
  121.                   }
  122.                }
  123.             }
  124.          }
  125.          if(this._x > _root.ramp1R2._x)
  126.          {
  127.             if(this._x < _root.ramp1R1._x)
  128.             {
  129.                _root.ball2rightRamp1 = true;
  130.                for(_loc5_ in _root.ball2splitSegment10)
  131.                {
  132.                   if(_root.ball2splitSegment10[_loc5_].isPossibleTarget(this))
  133.                   {
  134.                      tempSegments[tempSegments.length] = _root.ball2splitSegment10[_loc5_];
  135.                   }
  136.                }
  137.             }
  138.          }
  139.       }
  140.    }
  141.    if(this._y > _root.frTLine._y)
  142.    {
  143.       if(this._y < _root.frBLine._y)
  144.       {
  145.          if(this._x > _root.frLLine1._x)
  146.          {
  147.             if(this._x < _root.frLLine2._x)
  148.             {
  149.                _root.ball2leftFlipper = true;
  150.                for(_loc5_ in _root.ball2splitSegment16)
  151.                {
  152.                   if(_root.ball2splitSegment16[_loc5_].isPossibleTarget(this))
  153.                   {
  154.                      tempSegments[tempSegments.length] = _root.ball2splitSegment16[_loc5_];
  155.                   }
  156.                }
  157.             }
  158.          }
  159.          if(this._x > _root.frRLine2._x)
  160.          {
  161.             if(this._x < _root.frRLine1._x)
  162.             {
  163.                _root.ball2rightFlipper = true;
  164.                for(_loc5_ in _root.ball2splitSegment15)
  165.                {
  166.                   if(_root.ball2splitSegment15[_loc5_].isPossibleTarget(this))
  167.                   {
  168.                      tempSegments[tempSegments.length] = _root.ball2splitSegment15[_loc5_];
  169.                   }
  170.                }
  171.             }
  172.          }
  173.       }
  174.    }
  175.    if(this._y > _root.brTLine._y)
  176.    {
  177.       if(this._y < _root.brBLine._y)
  178.       {
  179.          if(this._x > _root.brLLine1._x)
  180.          {
  181.             if(this._x < _root.brLLine2._x)
  182.             {
  183.                _root.ball2leftBumper = true;
  184.                for(_loc5_ in _root.splitSegment2)
  185.                {
  186.                   if(_root.splitSegment2[_loc5_].isPossibleTarget(this))
  187.                   {
  188.                      tempSegments[tempSegments.length] = _root.splitSegment2[_loc5_];
  189.                   }
  190.                }
  191.             }
  192.          }
  193.          if(this._x > _root.brRLine2._x)
  194.          {
  195.             if(this._x < _root.brRLine1._x)
  196.             {
  197.                _root.ball2rightBumper = true;
  198.                for(_loc5_ in _root.splitSegment3)
  199.                {
  200.                   if(_root.splitSegment3[_loc5_].isPossibleTarget(this))
  201.                   {
  202.                      tempSegments[tempSegments.length] = _root.splitSegment3[_loc5_];
  203.                   }
  204.                }
  205.             }
  206.          }
  207.       }
  208.    }
  209.    if(this._y > _root.tbTLine._y)
  210.    {
  211.       if(this._y < _root.tbBLine._y)
  212.       {
  213.          if(this._x > _root.tbRLine._x)
  214.          {
  215.             _root.ball2rightTargetBlock = true;
  216.             for(_loc5_ in _root.ball2splitSegment13)
  217.             {
  218.                if(_root.ball2splitSegment13[_loc5_].isPossibleTarget(this))
  219.                {
  220.                   tempSegments[tempSegments.length] = _root.ball2splitSegment13[_loc5_];
  221.                }
  222.             }
  223.          }
  224.          else if(this._x < _root.tbLLine._x)
  225.          {
  226.             _root.ball2leftTargetBlock = true;
  227.             for(_loc5_ in _root.ball2splitSegment14)
  228.             {
  229.                if(_root.ball2splitSegment14[_loc5_].isPossibleTarget(this))
  230.                {
  231.                   tempSegments[tempSegments.length] = _root.ball2splitSegment14[_loc5_];
  232.                }
  233.             }
  234.          }
  235.       }
  236.    }
  237.    if(tempSegments.length == 1)
  238.    {
  239.       segmentT = tempSegments[0];
  240.       return undefined;
  241.    }
  242.    segMinDistance = 100000;
  243.    var _loc4_ = -1;
  244.    for(_loc5_ in tempSegments)
  245.    {
  246.       var _loc3_ = tempSegments[_loc5_].cachedDistance;
  247.       if(_loc3_ < segMinDistance && (_loc3_ > 0 || segmentT == tempSegments[_loc5_] || tempSegments[_loc5_].isCrossed))
  248.       {
  249.          segMinDistance = _loc3_;
  250.          _loc4_ = _loc5_;
  251.       }
  252.    }
  253.    if(_loc4_ != -1)
  254.    {
  255.       segmentT = tempSegments[_loc4_];
  256.    }
  257.    else
  258.    {
  259.       segmentT = null;
  260.    }
  261. }
  262.